{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}
    讲师列表页-慕学在线网
{% endblock %}
{% block custom_bread %}
    <section>
        <div class="wp">
            <ul class="crumbs">
                <li><a href="{% url 'index' %}">首页</a>></li>
                <li>讲师</li>
            </ul>
        </div>
    </section>
{% endblock %}

{% block content %}
    <section>
        <div class="wp butler_list_box list">
            <div class='left'>
                <div class="butler_list layout">
                    <div class="head">
                        <ul class="fl tab_header">
                            <li class="{% if sort == '' %}active{% endif %}"><a href="?sort=">全部</a></li>
                            <li class="{% if sort == 'hot' %}active{% endif %}"><a href="?sort=hot">人气 &#8595;</a></li>
                        </ul>
                        <div class="fr butler-num">共<span class="key">{{ teacher_nums }}</span>人&nbsp;&nbsp;&nbsp;</div>
                    </div>
                    {% for teacher in teachers.object_list %}
                        <dl class="des">
                            <dt>
                                <a href="{% url 'organization:teacher_detail' teacher.id %}">
                                    <div class="picpic">
                                        <img width="100" height="100" class="scrollLoading"
                                             src="{{ teacher.image.url }}"/>
                                    </div>
                                </a>
                                <div class="btn">
                                    <div class="fr btn2 bdsharebuttonbox"
                                         data-text="授课教师-{{ teacher.name }}-慕学在线"
                                         data-desc="我在#慕课网#发现了讲师“{{ teacher.name }}”，对学习中的小伙伴很有帮助，一起来看看吧。"
                                         data-comment="{{ teacher.name }}金牌讲师，从业年限：{{ teacher.work_years }}"
                                         data-tag="share_1"
                                    >
                                        <span class="fl">分享</span>
                                        <a href="#" class="bds_more" data-cmd="more"></a>
                                    </div>
                                </div>
                            </dt>
                            <dd>
                                <a href="{% url 'organization:teacher_detail' teacher.id %}">
                                    <h1>{{ teacher.name }}<span class="{% if teacher.is_auth %}key{% endif %} picbig">
                                        {% if teacher.is_gold %}金牌讲师{% endif %}
                                    </span></h1>
                                </a>
                                <ul class="cont">
                                    <li>工作年限：<span>{% if teacher.work_years > 0 %}{{ teacher.work_years }}年{% else %}无{% endif %}</span></li>
                                    <li>工作职位：<span>{{ teacher.work_position }}</span></li>
                                    <li>就职公司：<span>{{ teacher.work_company }}&nbsp;</span></li>
                                    <li>年龄：<span>{{ teacher.age }}</span></li>
                                    <li>教学特点：<span>{{ teacher.points }}</span></li>
                                </ul>
                            </dd>
                            <a class="buy buyservice" href="{% url 'organization:teacher_detail' teacher.id %}"><br/>查看<br/>详情</a>
                        </dl>
                    {% endfor %}
                </div>
                <div class="pageturn">
                    <ul class="pagelist">
                        {% if teachers.has_previous %}
                            <li class="long"><a href="?{{ teachers.previous_page_number.querystring }}">上一页</a></li>
                        {% endif %}

                        {% for page in teachers.pages %}
                            {% if page %}
                                {% ifequal page teachers.number %}
                                    <li class="active"><a href="?{{ page.querystring }}">{{ page }}</a></li>
                                {% else %}
                                    <li><a href="?{{ page.querystring }}" class="page">{{ page }}</a></li>
                                {% endifequal %}
                            {% else %}
                                <li class="none">...</li>
                            {% endif %}
                        {% endfor %}

                        {% if teachers.has_next %}
                            <li class="long"><a href="?{{ teachers.next_page_number.querystring }}">下一页</a></li>
                        {% endif %}
                    </ul>
                </div>
            </div>
            <div class="right layout">
                <div class="head">讲师排行榜</div>
                {% for hot_teacher in hot_teachers %}
                    <dl class="des">
                        <span class="num fl">1</span>
                        <a href="{% url 'organization:teacher_detail' hot_teacher.id %}">
                            <dt>
                                <img width="50" height="50" class="scrollLoading"
                                     src="{{ hot_teacher.image.url }}"/>
                            </dt>
                        </a>
                        <dd>
                            <a href="{% url 'organization:teacher_detail' hot_teacher.id %}">
                                <h1 title="{{ hot_teacher.name }}">{{ hot_teacher.name }}</h1>
                            </a>
                            <p>工作年限：<span>{% if hot_teacher.work_years > 0 %}{{ hot_teacher.work_years }}年{% else %}无{% endif %}</span></p>
                        </dd>
                    </dl>
                {% endfor %}
            </div>
        </div>
    </section>
{% endblock %}

{% block custom_js %}
    <script>
        var shareUrl = '',
            shareText = '',
            shareDesc = '',
            shareComment = '';
        $(function () {
            $(".bdsharebuttonbox a").mouseover(function () {
                var type = $(this).attr('data-cmd'),
                    $parent = $(this).parent('.bdsharebuttonbox'),
                    fxurl = $parent.attr('data-url'),
                    fxtext = $parent.attr('data-text'),
                    fxdesc = $parent.attr('data-desc'),
                    fxcomment = $parent.attr('data-comment');
                switch (type) {
                    case 'tsina':
                    case 'tqq':
                    case 'renren':
                        shareUrl = fxurl;
                        shareText = fxdesc;
                        shareDesc = '';
                        shareComment = '';
                        break;
                    default :
                        shareUrl = fxurl;
                        shareText = fxtext;
                        shareDesc = fxdesc;
                        shareComment = fxcomment;
                        break;
                }
            });
        });

        function SetShareUrl(cmd, config) {
            if (shareUrl) {
                config.bdUrl = "{{ SITE_URL }}" + shareUrl;
            }
            if (shareText) {
                config.bdText = shareText;
            }
            if (shareDesc) {
                config.bdDesc = shareDesc;
            }
            if (shareComment) {
                config.bdComment = shareComment;
            }

            return config;
        }

        window._bd_share_config = {
            "common": {
                "onBeforeClick": SetShareUrl,
                "bdMini": "2",
                "searchPic": "1",
                "bdMiniList": false
            },
            "share": {
                "bdSize": "16"
            }
        };
        with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion=' + ~(-new Date() / 36e5)];
    </script>
{% endblock %}
